/**
 * @description: tree data -> 扁平树
 * @param origin 数据源
 * @return treedata
 */
export function toFlatTree(origin: TreeData[]) {
  return origin.reduce((res, item) => {
    const { children, ...i } = item;
    return res.concat(i, children && children.length ? toFlatTree(children) : []);
  }, []);
}
